package com.course_design.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.course_design.entity.Teacher;
import com.course_design.service.TeacherService;

@Controller
public class TeacherController {
	@Autowired
	private TeacherService teacherService;
	@RequestMapping(value="/checkInfo")
	@ResponseBody
	public Msg checkInfo(Teacher teacher,HttpServletRequest request) {
		if(teacher!=null) {
			Teacher queryTeacherInfo = teacherService.queryTeacherInfo(teacher);
			if(queryTeacherInfo!=null) {
				HttpSession session=request.getSession();
				session.setAttribute("teacher", queryTeacherInfo);
				return Msg.success("OK");
			}else {
				return Msg.error("用户信息或者密码不正确");
			}
		}
		return Msg.error("请求不正确");
		
	}
}	
